<?php


/*%setcsname%*/
$name = 'employees';
/*END*/

//include_once '../../boot.php';
include_once $name . '_fields.php';
include_once $name . '_class.php';

// get data

/*%FilterClass%*/
	$flt = new CF_FilterQueryBase($employees_spec);
/*END*/	
	$Filters = $flt->get_filter_vals();

/*%SorterClass%*/
	$sorter = new CF_Sorter($employees_spec, $name);
/*END*/
	global $dbh;

/*%SetQuery%*/
	$qry_list = "SELECT * FROM employees WHERE 1  " ;
/*END*/	
	// Apply filters
/*%ApplyFilters%*/	
	$qry_list .=  $flt->make_query_PSfilter();
/*END*/	
	// apply sorting
/*%ApplySort%*/	
	$qry_list .= $sorter->make_query_sort();	
/*END*/

	$stmt = $dbh->prepare($qry_list);	

/*%BindFilters%*/
	$flt->make_PSfilter_bindings($stmt);
/*END*/
	
	$list = get_array_stmt($stmt);
/*%ArraySpec%*/	
	$arrayBySpec = new employeesArray($list,$employees_spec);
	$list = $arrayBySpec->fill_spec_array();
/*END*/
/*%Lookup%*/
	$employeeLookups = new employeesLookupList();
	$employeeLookups->SetFilter($Filters);
	$employeeLookups->ResolveSpecLists($employees_spec);
/*END*/
/*%FilterBox%*/	
	$filterbox = new CF_FilterFormFull($employees_spec,$Filters,$_SERVER['PHP_SELF']);
/*END*/
/*%Heading%*/	
	$heading = new CF_Header($employees_spec,$_SERVER['PHP_SELF']);
/*END*/
	
//class Employees_table extends CF_TableEdPage {

/*%TableClass%*/
class employeesTable extends CF_TableAjax {
/*END*/

/*%CloseClass%*/
}
/*END*/


/*%TableSetup%*/
$table = new employeesTable($employees_spec,$none,'employees');
$table->set_valuesarray($list);	
$table->actionpage = 'employees/employees_proc.php';
$table->set_lookup('reportsTo',$employeeLookups->lookup_reportsTo());
/*END*/

/*%MultiAct%*/
$multiact = new CF_Multiselect($employees_spec, $name, 'employees/employees_proc.php');
/*END*/
?>
<div id='<?php print $name ?>_table_dv' >
	<?php  print $filterbox->make_filters_box() ?>
	<table name='<?php print $name ?>'>
	<thead>
	<?php print $heading->make_sort_heading() ?>
	</thead>
	<tbody>
	<?php print $table->maketable();
	print '<script type="text/javascript">';
	print $table->make_supportJS(); 
	print "</script>";
	?>
	</tbody>
	</table>
</div>
<div>
<?php print $multiact->make_multi_act_row() ?>
</div>
